package com.mapforge.map.tools.tilewriting;

import java.awt.Point;

import com.mapforge.map.TileLayer;
import com.mapforge.map.tilewriter.TileWriter;
import com.mapforge.map.tools.selection.AbstractSelectionTool;
import com.mapforge.map.tools.selection.SelectionToolState;
import com.mapforge.selection.TileSelection;

public class TileWriterToolState extends SelectionToolState {

	private TileWriter tileWriter;
	private TileSelection tileSelection;
	private TileLayer tileLayer;

	public TileWriterToolState(Point startPoint, Point endPoint,
			TileLayer selectedLayer, TileSelection tileSelection,
			TileWriter tileWriter) {
		super(startPoint, endPoint);
		this.tileLayer = selectedLayer;
		this.tileWriter = tileWriter;
		this.tileSelection = tileSelection;
	}

	public void restoreState(AbstractSelectionTool tool) {
		super.restoreState(tool);
		if (tool instanceof AbstractTileWriterTool) {
			AbstractTileWriterTool tileTool = (AbstractTileWriterTool) tool;
			tileTool.setTileSelection(tileSelection);
			tileTool.setTileLayer(tileLayer);
			tileTool.setTileWriter(tileWriter);
		}
	}
}
